﻿@{
    Layout = null;
}

<html class="x-admin-sm">
<head>
    <meta name="viewport" content="width=device-width" />
    <meta charset="UTF-8">
    <title>仓库数据信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link href="~/X-admin/css/font.css" rel="stylesheet" />
    <script src="~/X-admin/lib/layui/layui.js"></script>
    <link href="~/X-admin/css/xadmin.css" rel="stylesheet" />
    <script src="~/X-admin/js/jquery.min.js"></script>
    <script src="~/X-admin/js/xadmin.js"></script>
    <script src="~/js/framework/sysframework.js"></script>
    <script src="~/js/framework/Common.js"></script>

    
</head>
<body>
    <div class="layui-fluid">
        <div id="bDiv">
        </div>
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body ">
                        <form class="layui-form layui-col-space5" name="qForm" id="qForm">
                            <div class="layui-inline layui-show-xs-block">

                                <input type="text" name="houseCode" placeholder="仓库编码" autocomplete="off" class="layui-input" id="houseCode">
                            </div>
                            <div class="layui-inline layui-show-xs-block">

                                <input type="text" name="houseName" placeholder="仓库名称" autocomplete="off" class="layui-input" id="houseName">
                            </div>

                            <div class="layui-inline layui-show-xs-block">
                                <button class="layui-btn" lay-filter="sreach" id="userSearch" type="button" onclick="loadData()"><i class="layui-icon">&#xe615;</i></button>
                            </div>
                        </form>
                    </div>

                    <div class="layui-card-header">
                        <button class="layui-btn layui-btn-normal" id="userAdd" type="button" onclick="syncData()"><i class="layui-icon"></i>数据同步</button>
                    </div>

                    <div class="layui-card-body layui-table-body layui-table-main">
                        <table class="layui-hide" id="list" lay-filter="list"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>

<script type="text/javascript">

    function loadData() {
        layui.use('table', function () {

            var conditon = JSON.stringify(FormToJson("qForm"));
            var table = layui.table;
            table.render({
                elem: '#list'
                , cols: [[ //标题栏
                    { field: 'id', title: 'ID', width: 80 }
                    , { field: 'houseCode', title: '仓库编码', width: 240 }
                    , { field: 'houseName', title: '仓库名称', width: 240 }
                    , { field: 'statusName', title: '数据状态', width: 240 }
                    , { field: 'isSyncName', title: '同步数据', width: 240 }

                ]], done: function (res, curr, count) {
                    $("[data-field='id']").css('display', 'none');//隐藏列

                }
                , height: $(document).height() - $('#list').offset().top - 20
                , url: "../Basic/GetDataList?dataType=wareHouse&condition=" + conditon
                , skin: 'row' //表格风格
                , even: true
                , page: true //是否显示分页
                , limits: [10, 15, 20]
                , limit: 10 //每页默认显示的数量
            });
            
        });
    }
    $(function () {
        webCode = getUrlVariable("menuCode");
        BannerData(webCode, "bDiv");
        //获取列表
        loadData();
    })
    function syncData() {
        $.ajax({
            //alert(1);
            url: "../System/SyncData?syncCode=wareHouse",
            dataType: "json",
            type: "POST",
            success: function (data) {
                if (data.result) {
                    layer.msg("同步执行成功");
                } else {
                    layer.msg(data.message);
                }
            }
        });
    }
</script>